﻿Public Class xtf_LISTADOmarca_

    Public Overrides Sub IniciarLista()
        Try
            gdc_general.BeginUpdate()
            gdc_general.DataSource = dtt_DataTable
            'ulg_Lista.DisplayLayout.GroupByBox.Style = Infragistics.Win.UltraWinGrid.GroupByBoxStyle.Full

            'Creacion y carga de Cuentas
            dtt_DataTable.Columns.Add("Identificador (ID)")
            dtt_DataTable.Columns.Add("Nombre")
            dtt_DataTable.Columns.Add("Nombre Corto")

            gdv_general.PopulateColumns(dtt_DataTable)

            Dim obj_marca_ As New cls_marca_
            If obj_marca_.CargarTodos(ObtenerRegistroEstado) Then
                For Each marca As cls_marca_ In obj_marca_.Items
                    AgregarItem(marca)
                Next
            End If
            'ulg_Lista.DataBind()

            FiltrarColumnas()
            gdc_general.EndUpdate()
        Catch ex As Exception
            'Dim frmError As New frm_ErrorManager(ex.Message)
        End Try
    End Sub

    Public Function AgregarItem(ByRef marca As cls_marca_) As DataRow
        Dim Row As DataRow = dtt_DataTable.NewRow
        Row("Identificador (ID)") = marca.idmarca
        Row("Nombre") = marca.nombre
        Row("Nombre corto") = marca.nombrecorto

        dtt_DataTable.Rows.Add(Row)
        'ulg_Lista.Rows(ulg_Lista.Rows.Count - 1).Height = 19
        Return Row
    End Function

    Public Sub ModificarItem(ByRef marca As cls_marca_, ByRef ulg_row As DataRow)
        ulg_row("Identificador (ID)") = marca.idmarca
        ulg_row("Nombre") = marca.nombre
        ulg_row("Nombre corto") = marca.nombrecorto
    End Sub

    Public Sub New()

        Me.Cursor = Cursors.WaitCursor
        InitializeComponent()
        PERMISONuevo = "001022002"
        PERMISOModificar = "001004003"
        PERMISOEliminar = "001022004"
        PERMISOImprimir = "001022005"
        Me.Text = lbl_modulo.Text
        IniciarLista()
        Me.Cursor = Cursors.Default

    End Sub

End Class